﻿using MengLin.OOP.DesignPattern.State.RoomManagerSys.Entity;
using MengLin.OOP.DesignPattern.State.RoomManagerSys.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MengLin.OOP.DesignPattern.State.RoomManagerSys.Implements
{
    /// <summary>
    /// 空闲状态
    /// </summary>
    public class FreeState : AbstractState
    {
        /// <summary>
        /// 得到房间的状态
        /// </summary>
        /// <returns></returns>
        public override string GetState()
        {
            return "当前房间状态是空闲状态";
        }

        /// <summary>
        /// 预订房间
        /// </summary>
        /// <param name="room"></param>
        public override void Book(Room room)
        {
            Console.WriteLine("当前为空闲状态，进行预订操作");
            room.SetState(new BookState());//预订状态
        }

        /// <summary>
        /// 退订房间
        /// </summary>
        /// <param name="room"></param>
        public override void UnBook(Room room)
        {
            Console.WriteLine("当前为空闲状态，无法进行取消预订操作");
        }

        /// <summary>
        /// 入住
        /// </summary>
        /// <param name="room"></param>
        public override void CheckIn(Room room)
        {
            Console.WriteLine("当前为空闲状态，进行入住操作");
            room.SetState(new InState());//入住状态
        }

        /// <summary>
        /// 退房
        /// </summary>
        /// <param name="room"></param>
        public override void CheckOut(Room room)
        {
            Console.WriteLine("当前为空闲状态，无法进行退房操作");
        }
    }
}
